package com.gzgs.controller;


import com.gzgs.domain.SysLog;
import com.gzgs.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/sysLog")
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;
    @RequestMapping("/findAll.do")
    public ModelAndView findAll()throws Exception{
        ModelAndView mv=new ModelAndView();
        List<SysLog> sysLogs=sysLogService.findAll();
        mv.addObject("sysLogs",sysLogs);
        mv.setViewName("syslog-list");
        return  mv;
    }


    //sysLog/deleteLog.do?
    @RequestMapping("/deleteLog.do")
    public String deleteLog(String id) throws Exception {
        sysLogService.deleteById(id);
        return "redirect:findAll.do";
    }
}
